<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
    var findMedianSortedArrays = function(nums) {
      const length = nums.length;
      let max = 0;
      if(length === 1 || length === 0) {
        return 0
      } else if(length === 2) {
        return Math.abs(nums[0] - nums[1]);
      } else {
        let abs = 0;
        for (let i = length - 1, temp; i > 0; i--) {
          for (let j = 0; j < i; j++) {
            temp = nums[j]
            if(temp > nums[j + 1]) {
              nums[j] = nums[j + 1]
              nums[j + 1] = temp
            }
          }
          if(i !== length - 1) {  
            abs = Math.abs(nums[i + 1] - nums[i]);
            if(abs > max) {
              max = abs;
            }
          }
          
        }
      }      
      return Math.max(max, Math.abs(nums[0] - nums[1]));
    }
    console.log(findMedianSortedArrays([13,16,19,1]));
    
  </script>
</body>
</html>